package com.dcy.znoa.domain.publiz;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.dcy.znoa.domain.Oper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author pengyu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("department")
public class Department {

    public static final String TO_AUDIT ="待审批";

    @TableId(type = IdType.AUTO, value = "dep_id")
    Long depId;

    @TableField
    String depName;//dep_name

    @TableField
    Integer depLevel;//dep_level 1 为最大， 每个公司唯一

    @TableField
    Integer depType;//dep_type 1为部门，2为分公司，为二期预留

    @TableField
//    @JsonProperties("pDeptId")
    Long pDepId;//p_dep_id

    @TableField
    Long compId;//comp_id

    @TableField
    String contactMan;//contact_man

    @TableField("create_oper_id")
    Long createOperId;

    @TableField("create_time")
    Date createTime;

    @TableField("update_oper_id")
    Long updateOperId;

    @TableField("update_time")
    Date updateTime;

    @TableField("valid_flag")
    Integer validFlag;

    @TableField(exist = false)
    private List<Department> subDepList;//下级机构列表

    @TableField(exist = false)
    private List<Oper> managerList;//部门负责人

    @TableField(exist = false)
    private List<Oper> employeeList;//部门普通员工,雇员

    @TableField(exist = false)
    private  Integer operSize;//managerList + employeeList 数量和

    public Department(String depName, Integer depLevel, Integer depType, Long compId,Long pDepId,Long createOperId, Date createTime, Integer validFlag) {
        this.depName = depName;
        this.depLevel = depLevel;
        this.depType = depType;
        this.pDepId = pDepId;
        this.compId = compId;
        this.createOperId = createOperId;
        this.createTime = createTime;
        this.validFlag = validFlag;
    }
}
